/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.business.customer.core.repository.mapper;

import info.peigen.hotpot.business.customer.core.repository.entity.CustomerOperatorEntity;
import info.peigen.hotpot.component.data.repository.beetlsql.mapper.AbstractBeetlSqlMapper;
import org.apache.ibatis.annotations.Mapper;
import org.beetl.sql.mapper.annotation.Select;
import org.beetl.sql.mapper.annotation.Sql;
import org.beetl.sql.mapper.annotation.Update;

import java.util.List;

/**
 * <b>(CustomerOperatorMapper)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/8/1
 */
@SuppressWarnings("AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc")
@Mapper
public interface CustomerOperatorMapper extends AbstractBeetlSqlMapper<CustomerOperatorEntity> {
    @Sql("select * from customer_operator where operator_id = ?")
    @Select
    CustomerOperatorEntity findByOperatorId(String operatorId);

    @Sql("select * from customer_operator where login_name = ?")
    @Select
    CustomerOperatorEntity findByLoginName(String loginName);

    @Sql("select * from customer_operator where customer_id = ?")
    @Select
    List<CustomerOperatorEntity> listByCustomerId(String customerId);

    @Sql("delete from customer_operator where customer_id = ?")
    @Update
    void deleteByCustomerId(String customerId);

    @Sql("delete from customer_operator where operator_id = ?")
    @Update
    void deleteByOperatorId(String operatorId);
}